using System;
using System.Collections.Generic;
using System.Text;

namespace Watchdog.Dal {

    public static class DataClient {

        static WatchdogDataServiceClient current;

        public static WatchdogDataServiceClient Current {
            get {
                if (current == null) {
                    current = new WatchdogDataServiceClient ();
                    current.ChannelFactory.Faulted += new EventHandler (ChannelFactory_Faulted);
                }
                return current;
            }
        }

        static void ChannelFactory_Faulted ( object sender, EventArgs e ) {
            Log.Write (Severity.Error, sender);
            current.ChannelFactory.Close ();
            current.ChannelFactory.Open ();

        }

    }
}
